1. Field of the Invention
This invention is related to the field of checksum generation.
2. Description of the Related Art
Checksumming is often used in electronic systems for error detection in the transmission and/or storage of data. For example, packet data communicated on a network between systems may often include a checksum calculated over the packet data. The checksum is based on the number of set, or binary one, bits in the data. Thus, a transmitting system may calculate the checksum over the data being transmitted, and may included the calculated checksum in the transmitted data. A receiving system may use the same algorithm to check that the data (including the checksum) has arrived without error.
Packets that conform to the transport control protocol (TCP) and internet protocol (IP) use a 16 bit checksum calculated over a portion of the IP header (referred to as the “pseudo-header”), the TCP header, and the packet data that is provided subsequent to the TCP header. The checksum is a one's complement sum of the data over which it is calculated, where the data is divided into 16-bit portions for the summing process. Typically, a 26 bit accumulator is used to accumulate the sum (which permits 10 bits of carry over the 16 bit sum, enough to handle the largest non-jumbo packet of 1522 bytes). The 10 bits of carry are then added back into the 16 bit sum, which may produce a single bit of carry, which again is added back into the 16 bit sum. Accordingly, checksum generation requires 3 passes through adder hardware: a first pass to generate the initial 26 bit sum, a second pass to add the 10 bit carry, and a third pass to add the one bit carry.